; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -passes=globalopt < %s | FileCheck %s

@g = internal global [8 x i8] undef

define void @test() {
; CHECK-LABEL: @test(
; CHECK-NEXT:    ret void
;
  store i32 1, ptr @g
  store i32 2, ptr getelementptr (i32, ptr @g, i64 1)
  ret void
}

define i32 @load1() {
; CHECK-LABEL: @load1(
; CHECK-NEXT:    ret i32 1
;
  %v = load i32, ptr @g
  ret i32 %v
}

define i32 @load2() {
; CHECK-LABEL: @load2(
; CHECK-NEXT:    ret i32 2
;
  %v = load i32, ptr getelementptr (i32, ptr @g, i64 1)
  ret i32 %v
}
